// import { useUserStore } from '@/stores/global/user'
// import { useRouteStore } from '@/store/routeStore/userStore'
const list = { currentUser: ['admin', '1', '2', '3'], name: 'admin' }

/**
 * 判断是否有权限
 * @param permissions 权限代码
 * @returns
 */
export const isAuth = (permissions: string[]): boolean => {
  if (!permissions || permissions.length === 0) return false

  // 从全局数据中获取当前用户按钮权限列表
  // const { currentUser } = useRouteStore.getState()
  const { currentUser } = list // 假设 list 是一个有效的全局数据源

  // 检查当前用户的权限列表是否包含任何指定的权限
  return currentUser.some(userPerm => permissions.some(permission => permission === userPerm))
}
